<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.wanmait.movies.vo.MonfinMovieRecords"%>
<%@page import="com.wanmait.movies.vo.DeleteMovieRecords"%>
<%@page import="com.wanmait.movies.vo.AddMovieRecords"%>
<%@page import="com.wanmait.movies.vo.Report"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/movies/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
	$(function(){
		$("#input").click(function(){
			var movie =$("#text").val();
			
			$.ajax({
				url:"/movies/ManegerServlet?action=getMovieReportList",
				async:false,
				type:"get",
				data:"movie="+movie,
				success:function(s){
				
					$("#list").html("");
					
					$("#list").append(s);
					
				}
			});
		});
		
	});
	$(function () {
		   $(".addrecords,.deleterecords,.modfinrecords").css("display","none");
		   $(".reporton").css("font-size","20px");
	        $(".reporton").css("font-weight","600");
	})
	$(function () {
		$("#circle").on("click",".reporton,.addon,.deleteon,.modfin",function(){
		        $(".reporton,.addon,.deleteon,.modfin").css("font-weight","bold");
		        $(".reporton,.addon,.deleteon,.modfin").css("font-size","16px");
		        $(this).css("font-size","20px");
		        $(this).css("font-weight","600");
		    });
		    
		    $(".reporton").click(function(){
		        $(".reportrecords").css("display","block");
		        $(".addrecords,.deleterecords,.modfinrecords").css("display","none");
		        
		    });
		    $(".addon").click(function(){
		        $(".addrecords").css("display","block");
		        $(".reportrecords,.deleterecords,.modfinrecords").css("display","none");
		        
		    });
		    $(".deleteon").click(function(){
		        $(".deleterecords").css("display","block");
		        $(".reportrecords,.addrecords,.modfinrecords").css("display","none");
		        
		    });
		    $(".modfin").click(function(){
		        $(".modfinrecords").css("display","block");
		        $(".reportrecords,.addrecords,.deleterecords").css("display","none");
		        
		    });
	})
	$(function () {
	$(".ThisPage").blur(function(){//这是举报text查找页数的
		var thispage=$(".ThisPage").val();
		var pagemax=$(".NextPage").attr("pagemax");
		if(thispage==""){
			thispage=1;
		}
		if(thispage>pagemax){
			thispage=pagemax;
			$(".ThisPage").val(pagemax);
		}else{
			$.ajax({
				url:"/movies/ManegerServlet?action=getReportHistoryAjax",
				async:false,
				type:"get",
				data:"thispage="+thispage,
				success:function(mes){
					$(".reportrecords_ul").html("");
					$(".ThisPage").val(thispage);
					$(".reportrecords_ul").html(mes);
				}
			})
		}
		
	});
});
	$(function () {//举报回车事件
		$(".ThisPage").keydown(function(e){
			var thispage=$(".ThisPage").val();
			var pagemax=$(".NextPage").attr("pagemax");
			if(thispage==""){
				thispage=1;
				
			}
			var h=e||window.event;
			if(h.which=="13"){
				if(thispage<=pagemax){
					$.ajax({
						url:"/movies/ManegerServlet?action=getReportHistoryAjax",
						async:false,
						type:"get",
						data:"thispage="+thispage,
						success:function(s){
							$(".reportrecords_ul").html("");
							$(".ThisPage").val(thispage);
							$(".reportrecords_ul").html(s);
						}	
					})
				}
			}
			})
	});
	$(function () {
		$("#circle").on("click",".LastPage",function(){//举报上一页
			//alert("11654");
			var thispage=$(".ThisPage").val();
			thispage--;
			if(thispage==""){
				thispage=1;
			}
			if(thispage>0){
				$.ajax({
					url:"/movies/ManegerServlet?action=getReportHistoryAjax",
					async:false,
					type:"get",
					data:"thispage="+thispage,
					success:function(s){
						$(".reportrecords_ul").html("");
						$(".ThisPage").val(thispage);
						$(".reportrecords_ul").html(s);
					}
				})
			}
		});
	});
	$(function () {
		$("#circle").on("click",".NextPage",function(){//举报下一页
			var thispage=$(".ThisPage").val();
			var pagemax=$(".NextPage").attr("pagemax");
			      thispage++;
			      //alert(pagemax);
			      if(thispage==""){
						thispage=1;
					}
			if(thispage<=pagemax){
				$.ajax({
					url:"/movies/ManegerServlet?action=getReportHistoryAjax",
					async:false,
					type:"get",
					data:"thispage="+thispage,
					success:function(s){
						$(".reportrecords_ul").html("");
						$(".ThisPage").val(thispage);
						$(".reportrecords_ul").html(s);	
					}
				})
			}
			});
	});
	
	
	
	$(function () {
		$(".addThisPage").blur(function(){//这是添加text查找页数的
			var thispage=$(".addThisPage").val();
			var pagemax=$(".addNextPage").attr("addpagemax");
			if(thispage==""){
				thispage=1;
				
			}
			if(thispage>pagemax){
				thispage=pagemax;
				$(".addThisPage").val(pagemax);
			}else{
				$.ajax({
					url:"/movies/ManegerServlet?action=getAddHistoryAjax",
					async:false,
					type:"get",
					data:"addthispage="+thispage,
					success:function(mes){
						$(".addrecords_ul").html("");
						$(".addThisPage").val(thispage);
						$(".addrecords_ul").html(mes);
					}
				})
			}
			
		});
	});
	
	$(function () {//添加记录回车事件
		$(".addThisPage").keydown(function(e){
			var thispage=$(".addThisPage").val();
			var pagemax=$(".addNextPage").attr("addpagemax");
			if(thispage==""){
				thispage=1;
				
			}
			var h=e||window.event;
			if(h.which=="13"){
				//alert(pagemax);
				if(thispage<=pagemax){
					$.ajax({
						url:"/movies/ManegerServlet?action=getAddHistoryAjax",
						async:false,
						type:"get",
						data:"addthispage="+thispage,
						success:function(s){
							$(".addrecords_ul").html("");
							$(".addThisPage").val(thispage);
							$(".addrecords_ul").html(s);
						}	
					})
				}
			}
			})
	});	
	$(function () {
		$("#circle").on("click",".addLastPage",function(){//添加记录上一页
			//alert("11654");
			var thispage=$(".addThisPage").val();
			thispage--;
			if(thispage==""){
				thispage=1;
			}
			if(thispage>0){
				$.ajax({
					url:"/movies/ManegerServlet?action=getAddHistoryAjax",
					async:false,
					type:"get",
					data:"addthispage="+thispage,
					success:function(s){
						$(".addrecords_ul").html("");
						$(".addThisPage").val(thispage);
						$(".addrecords_ul").html(s);
					}
				})
			}
		});
	});
	$(function () {
		$("#circle").on("click",".addNextPage",function(){//添加记录下一页
			var thispage=$(".addThisPage").val();
			var pagemax=$(".addNextPage").attr("addpagemax");
			      thispage++;
			      //alert(pagemax);
			      if(thispage==""){
						thispage=1;
					}
			if(thispage<=pagemax){
				$.ajax({
					url:"/movies/ManegerServlet?action=getAddHistoryAjax",
					async:false,
					type:"get",
					data:"addthispage="+thispage,
					success:function(s){
						$(".addrecords_ul").html("");
						$(".addThisPage").val(thispage);
						$(".addrecords_ul").html(s);	
					}
				})
			}
			});
	});
	
	
	
	
	
	
	
	$(function () {
		$(".deleteThisPage").blur(function(){//这是删除text查找页数的
			var thispage=$(".deleteThisPage").val();
			var pagemax=$(".deleteNextPage").attr("deletepagemax");
			if(thispage==""){
				thispage=1;
				
			}
			if(thispage>pagemax){
				thispage=pagemax;
				$(".deleteThisPage").val(pagemax);
			}else{
				$.ajax({
					url:"/movies/ManegerServlet?action=getDeleteHistoryAjax",
					async:false,
					type:"get",
					data:"deletethispage="+thispage,
					success:function(mes){
						$(".deleterecords_ul").html("");
						$(".deleteThisPage").val(thispage);
						$(".deleterecords_ul").html(mes);
					}
				})
			}
			
		});
	});
	
	$(function () {//删除记录回车事件
		$(".deleteThisPage").keydown(function(e){
			var thispage=$(".deleteThisPage").val();
			var pagemax=$(".deleteNextPage").attr("deletepagemax");
			if(thispage==""){
				thispage=1;
			}
			var h=e||window.event;
			if(h.which=="13"){
				//alert(pagemax);
				if(thispage<=pagemax){
					$.ajax({
						url:"/movies/ManegerServlet?action=getDeleteHistoryAjax",
						async:false,
						type:"get",
						data:"deletethispage="+thispage,
						success:function(s){
							$(".deleterecords_ul").html("");
							$(".deleteThisPage").val(thispage);
							$(".deleterecords_ul").html(s);
						}	
					})
				}
			}
			})
	});	
	$(function () {
		$("#circle").on("click",".deleteLastPage",function(){//删除记录上一页
			//alert("11654");
			var thispage=$(".deleteThisPage").val();
			thispage--;
			if(thispage==""){
				thispage=1;
			}
			if(thispage>0){
				$.ajax({
					url:"/movies/ManegerServlet?action=getDeleteHistoryAjax",
					async:false,
					type:"get",
					data:"deletethispage="+thispage,
					success:function(s){
						$(".deleterecords_ul").html("");
						$(".deleteThisPage").val(thispage);
						$(".deleterecords_ul").html(s);
					}
				})
			}
		});
	});
	$(function () {
		$("#circle").on("click",".deleteNextPage",function(){//删除记录下一页
			var thispage=$(".deleteThisPage").val();
			var pagemax=$(".deleteNextPage").attr("deletepagemax");
			      thispage++;
			      //alert(pagemax);
			      if(thispage==""){
						thispage=1;
					}
			if(thispage<=pagemax){
				$.ajax({
					url:"/movies/ManegerServlet?action=getDeleteHistoryAjax",
					async:false,
					type:"get",
					data:"deletethispage="+thispage,
					success:function(s){
						$(".deleterecords_ul").html("");
						$(".deleteThisPage").val(thispage);
						$(".deleterecords_ul").html(s);	
					}
				})
			}
			});
	});
	

	
	
	
	
	$(function () {
		$(".modfinThisPage").blur(function(){//这是修改text查找页数的
			var thispage=$(".modfinThisPage").val();
			var pagemax=$(".modfinNextPage").attr("modfinpagemax");
			if(thispage==""){
				thispage=1;
			}
			if(thispage>pagemax){
				thispage=pagemax;
				$(".modfinThisPage").val(pagemax);
			}else{
				$.ajax({
					url:"/movies/ManegerServlet?action=getModfinHistoryAjax",
					async:false,
					type:"get",
					data:"modfinthispage="+thispage,
					success:function(mes){
						$(".modfinrecords_ul").html("");
						$(".modfinThisPage").val(thispage);
						$(".modfinrecords_ul").html(mes);
					}
				})
			}
			
		});
	});
	
	$(function () {//修改记录回车事件
		$(".modfinThisPage").keydown(function(e){
			var thispage=$(".modfinThisPage").val();
			var pagemax=$(".modfinNextPage").attr("modfinpagemax");
			if(thispage==""){
				thispage=1;
			}
			var h=e||window.event;
			if(h.which=="13"){
				//alert(pagemax);
				if(thispage<=pagemax){
					$.ajax({
						url:"/movies/ManegerServlet?action=getModfinHistoryAjax",
						async:false,
						type:"get",
						data:"modfinthispage="+thispage,
						success:function(s){
							$(".modfinrecords_ul").html("");
							$(".modfinThisPage").val(thispage);
							$(".modfinrecords_ul").html(s);
						}	
					})
				}
			}
			})
	});	
	$(function () {
		$("#circle").on("click",".modfinLastPage",function(){//修改记录上一页
			//alert("11654");
			var thispage=$(".modfinThisPage").val();
			thispage--;
			if(thispage==""){
				thispage=1;
			}
			if(thispage>0){
				$.ajax({
					url:"/movies/ManegerServlet?action=getModfinHistoryAjax",
					async:false,
					type:"get",
					data:"modfinthispage="+thispage,
					success:function(s){
						$(".modfinrecords_ul").html("");
						$(".modfinThisPage").val(thispage);
						$(".modfinrecords_ul").html(s);
					}
				})
			}
		});
	});
	$(function () {
		$("#circle").on("click",".modfinNextPage",function(){//修改记录下一页
			var thispage=$(".modfinThisPage").val();
			var pagemax=$(".modfinNextPage").attr("modfinpagemax");
			      thispage++;
			      //alert(pagemax);
			      if(thispage==""){
						thispage=1;
					}
			if(thispage<=pagemax){
				$.ajax({
					url:"/movies/ManegerServlet?action=getModfinHistoryAjax",
					async:false,
					type:"get",
					data:"modfinthispage="+thispage,
					success:function(s){
						$(".modfinrecords_ul").html("");
						$(".modfinThisPage").val(thispage);
						$(".modfinrecords_ul").html(s);	
					}
				})
			}
			});
	});
	
</script>
</head>
<body>
<div id="circle">
    <div style="margin-bottom:20px;text-align: center;">
    	电影名:<input type ="text" id="text"> 
    	<input type="button" value="搜索" id="input">
    </div>
    <div class="recordshead" >
    <div class="reporton" ><a href="javascript:">举报处理记录</a></div>
	<div class="addon" ><a href="javascript:">添加电影记录</a></div>
	<div class="deleteon"><a href="javascript:">删除电影记录</a></div>
	<div class="modfin" ><a href="javascript:">修改电影记录</a></div>
	</div>
	<ul id="list">
	<hr>
	<li class="reportrecords">
	<ul class="reportrecords_ul">
	<% ArrayList<Report> list= (ArrayList<Report>)request.getAttribute("reportLIst"); %>
	<% if(list.size()==0){%>
		<li>无处理记录</li>
		<hr>
	<%}else{%>
	     <%  for(Report report:list){
			 if(report.getDiscussId().isCheckBit()){%>
			    <li mid="<%= report.getDiscussId().getMovieId().getId()%>">
				<span>同意了</span>
			<%}else{%>
				<span>驳回了</span>
			<%}%>

				<span><%=report.getUserId().getUserName() %></span>
				<span>对电影:<%=report.getDiscussId().getMovieId().getMovieName()%></span>
				<span>举报的评论:</span>
				<p><%=report.getDiscussId().getMovieDiscuss() %></p>
				<span><%=new SimpleDateFormat("yyyy-MM-dd").format(report.getDealTime())%></span>
				
				</li>
				<hr >
				<%}
		}%>		
			</ul>
			<div class="reportfenye">
    	  <a href="javascript:" class="LastPage">上一页</a>
          <input class="ThisPage"  type="text"  value="<%=request.getAttribute("thispage") %>" />
          <a href="javascript:" class="NextPage" pagemax="<%=request.getAttribute("pagemax")%>">下一页</a>
          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共(<%=request.getAttribute("pagemax") %>)页</span>
			</div>
			</li>
			
			<li class="addrecords">
			<ul class="addrecords_ul" >
			<% ArrayList<AddMovieRecords> addlist= (ArrayList<AddMovieRecords>)request.getAttribute("addList"); %>
	<% if(addlist.size()==0){%>
		<li>无处理记录</li>
		<hr>
	<%}else{%>
	     <%  for(AddMovieRecords add:addlist){
			 %>
			    <li mid="<%= add.getId()%>">
			    <%=new SimpleDateFormat("yyyy-MM-dd").format(add.getTimestamp())%>  添加了电影:<%=add.getMoviename() %>
				</li>
				<hr>
				<%}
		}%>		
			</ul>
			<div class="addfenye">
    	  <a href="javascript:" class="addLastPage">上一页</a>
          <input class="addThisPage"  type="text"  value="<%=request.getAttribute("addthispage") %>" />
          <a href="javascript:" class="addNextPage" addpagemax="<%=request.getAttribute("addpagemax")%>">下一页</a>
          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共(<%=request.getAttribute("addpagemax") %>)页</span>
			</li>
			
			<li class="deleterecords">
			<ul class="deleterecords_ul" >
			<% ArrayList<DeleteMovieRecords> deletelist= (ArrayList<DeleteMovieRecords>)request.getAttribute("deleteList"); %>
	<% if(deletelist.size()==0){%>
		<li>无处理记录</li>
		<hr>
	<%}else{%>
	     <%  for(DeleteMovieRecords delete:deletelist){
			 %>
			    <li mid="<%=delete.getId()%>">
			    <%=new SimpleDateFormat("yyyy-MM-dd").format(delete.getTimestamp())%>  删除了电影:<%=delete.getMoviename() %>
				</li>
				<hr >
				<%}
		}%>		
			</ul>
			<div class="deletefenye">
    	  <a href="javascript:" class="deleteLastPage">上一页</a>
          <input class="deleteThisPage"  type="text"  value="<%=request.getAttribute("deletethispage") %>" />
          <a href="javascript:" class="deleteNextPage" deletepagemax="<%=request.getAttribute("deletepagemax")%>">下一页</a>
          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共(<%=request.getAttribute("deletepagemax") %>)页</span>
			</li>
			
			<li class="modfinrecords">
			<ul class="modfinrecords_ul" >
			<% ArrayList<MonfinMovieRecords> modfinlist= (ArrayList<MonfinMovieRecords>)request.getAttribute("modfinList"); %>
	<% if(modfinlist.size()==0){%>
		<li>无处理记录</li>
		<hr>
	<%}else{%>
	     <%  for(MonfinMovieRecords modfin:modfinlist){
			 %>
			    <li mid="<%=modfin.getId()%>">
			    <%=new SimpleDateFormat("yyyy-MM-dd").format(modfin.getTimestamp())%>
			    <br>
                        修改了电影名字:<%=modfin.getMovieName() %>
                        <br>
			   <div class="jianjie"> 简介:<%=modfin.getMovieIntroduction() %>...</div>
			    <%
			    if(modfin.getMovieImage()!=null){
			    	%>
			    图片:<img src="/movies/images/<%=modfin.getMovieImage() %>" />
			    <%
			    }
			    %>  
			    <br>
			 <%
			 if(modfin.isCheckBit()==true){
				 %>
				改为热映
			 <%
			 }else{
			 %>
			        改为不热映
			<% 
			 }
			%>
				</li>
				<hr>
				<%}
	}
		%>		
			</ul>
			<div class="modfinfenye">
    	  <a href="javascript:" class="modfinLastPage">上一页</a>
          <input class="modfinThisPage"  type="text"  value="<%=request.getAttribute("modfinthispage") %>" />
          <a href="javascript:" class="modfinNextPage" modfinpagemax="<%=request.getAttribute("modfinpagemax")%>">下一页</a>
          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共(<%=request.getAttribute("modfinpagemax") %>)页</span>
			</li>
	</ul>
	
</div>
			<style type="text/css">
			  .addrecords_ul li{
			  height:100px;
			  font-size:16px;
			  
			  }
			  .deleterecords_ul li{
			  height:100px;
			  font-size:16px;
			  }
			  .modfinrecords_ul li{
			  height:150px;
			  font-size:16px;
			  }
			  .modfinrecords_ul li img{
			    width:50px;
			    
			  }
			  .jianjie{
			  width:400px;
			  height:20px;
			  overflow: hidden;
			  }
				#list{
					list-style: none;
					padding:0px 0px;
					margin:0px 0px;
				}
				#text{
				border:1px solid gray;
				border-radius: 10px;
				margin-left:10px;
				}
				#input{
				background-color:white;
				border:1px solid gray;
				border-radius: 10px;
				margin-left:10px;
				}
				body{
				    background-color: white;
				    font-size:15px;
				    font-weight:bold;
				}
				
				
				#circle{
					width:700px;
					padding-left:100px;
					padding-top: 20px;
					height:650px;
					border:solid 1px black;
				}
				p{
				    font-size:15px;
				    font-weight:normal;
				}
				.recordshead{
				width:700px;
				height:30px;
			}
			.recordshead div{
			font-size:16px;
			font-weight: bold;
			float:left;
			width:150px;
			
			}
			.recordshead a{
	          color:black;
	          text-decoration: none;
	         }
	        ul{
	        list-style: none;
	        }
	        
	        
	        .reportrecords{
	        width:700px;
	        height:500px;
	        border:solid 1px black;
	        }
	        .reportrecords_ul{
	       width:600px;
	        height:470px;
	        border:solid 1px black;
	        overflow:auto;
	        }
	        .reportfenye {
	        width:400px;
	        wieth:26px;
	        padding-left: 200px;
	        }
	        .reportfenye a{
	          color:red;
	          text-decoration: none;
	         }
	        .ThisPage{
	        width:30px;
	        }
	        
	        
	         .addrecords{
	        width:700px;
	        height:500px;
	        border:solid 1px black;
	        }
	        .addrecords_ul{
	       width:600px;
	        height:470px;
	        border:solid 1px black;
	         overflow:auto;
	        }
	        .addfenye {
	        width:400px;
	        wieth:26px;
	        padding-left: 200px;
	        }
	        .addfenye a{
	          color:red;
	          text-decoration: none;
	         }
	        .addThisPage{
	        width:30px;
	        }
	        
	        
	         .deleterecords{
	        width:700px;
	        height:500px;
	        border:solid 1px black;
	        }
	        .deleterecords_ul{
	       width:600px;
	        height:470px;
	        border:solid 1px black;
	         overflow:auto;
	        }
	        .deletefenye {
	        width:400px;
	        wieth:26px;
	        padding-left: 200px;
	        }
	        .deletefenye a{
	          color:red;
	          text-decoration: none;
	         }
	        .deleteThisPage{
	        width:30px;
	        }
	        
	        
	        
	        .modfinrecords{
	        width:700px;
	        height:500px;
	        border:solid 1px black;
	        }
	        .modfinrecords_ul{
	       width:600px;
	        height:470px;
	        border:solid 1px black;
	         overflow:auto;
	        }
	        .modfinfenye {
	        width:400px;
	        wieth:26px;
	        padding-left: 200px;
	        }
	        .modfinfenye a{
	          color:red;
	          text-decoration: none;
	         }
	        .modfinThisPage{
	        width:30px;
	        }
			</style>
		
</body>
</html>